package tangyaxin.www.saoerweima;

import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * Created by Administrator on 2016/6/15.
 */
public abstract class BaseFragment extends Fragment {
    private int layoutResId;
    private View layouView;

    protected abstract void findview();
    protected abstract void initview();

    public BaseFragment(int layoutResId) {
        this.layoutResId = layoutResId;
    }
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        layouView=inflater.inflate(layoutResId,null);
        return layouView;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        findview();
        initview();
    }
    public View findViewById(int resId){
        return layouView.findViewById(resId);
    }
}
